package com.ghpt.controller;
import com.ghpt.pojo.LengCN;
import com.ghpt.service.LengCNService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/lengcn")
public class LengCNController {
    private final LengCNService lengCNService;

    public LengCNController(LengCNService lengCNService) {
        this.lengCNService = lengCNService;
    }
    @GetMapping("/{id}")
    public LengCN getLengCNById(@PathVariable Long id) {
        System.out.println("结果是"+lengCNService.findLengCNById(id));
        return lengCNService.findLengCNById(id);
    }
    @PutMapping
    public int updateLengCN(@RequestBody LengCN lengCN) {
        return lengCNService.updateById(lengCN);
    }
}
